<!DOCTYPE html>


<html lang="zh-CN">


<head>
  <meta charset="utf-8" />
    
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    Echarts柱状极坐标风向玫瑰图的实现 |  Shimmer
  </title>
  <meta name="generator" content="hexo-theme-ayer">
  
  <link rel="shortcut icon" href="/myBlog/images/ayer.svg" />
  
  
<link rel="stylesheet" href="/myBlog/dist/main.css">

  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/css/remixicon.min.css">
  
<link rel="stylesheet" href="/myBlog/css/custom.css">

  
  <script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
  
  

  

<link rel="alternate" href="/myBlog/atom.xml" title="Shimmer" type="application/atom+xml">
</head>

</html>

<body>
  <div id="app">
    
      
      <canvas width="1777" height="841"
        style="position: fixed; left: 0px; top: 0px; z-index: 99999; pointer-events: none;"></canvas>
      
    <main class="content on">
      <section class="outer">
  <article
  id="post-2022-05-19-echarts实现风向玫瑰图"
  class="article article-type-post"
  itemscope
  itemprop="blogPost"
  data-scroll-reveal
>
  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  Echarts柱状极坐标风向玫瑰图的实现
</h1>
 

    </header>
     
    <div class="article-meta">
      <a href="/myBlog/2022/05/19/2022-05-19-echarts%E5%AE%9E%E7%8E%B0%E9%A3%8E%E5%90%91%E7%8E%AB%E7%91%B0%E5%9B%BE/" class="article-date">
  <time datetime="2022-05-18T16:00:00.000Z" itemprop="datePublished">2022-05-19</time>
</a>   
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> 字数统计:</span>
            <span class="post-count">1.7k</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> 阅读时长≈</span>
            <span class="post-count">10 分钟</span>
        </span>
    </span>
</div>
 
    </div>
      
    <div class="tocbot"></div>




  
    <div class="article-entry" itemprop="articleBody">
       
  <h2 id="Echarts柱状极坐标风向玫瑰图的实现"><a href="#Echarts柱状极坐标风向玫瑰图的实现" class="headerlink" title="Echarts柱状极坐标风向玫瑰图的实现"></a>Echarts柱状极坐标风向玫瑰图的实现</h2><h3 id="echarts代码"><a href="#echarts代码" class="headerlink" title="echarts代码"></a>echarts代码</h3><p>本来看到玫瑰图，就看到了echarts示例中饼图的南丁格尔玫瑰图。</p>
<p>发现不太像。后来发现是柱状图极坐标系堆叠图。</p>
<p>图例是自己实现的，因为是绑定到单个数据上。</p>
<p>eharts的配置项真的太难了。找的很头疼，实现的也很头疼。</p>
<p>效果如下：</p>
<p><a target="_blank" rel="noopener" href="https://imgse.com/i/pScPFuF"><img src="https://s1.ax1x.com/2023/02/06/pScPFuF.md.png" alt="pScPFuF.md.png"></a></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">import React, &#123;FC, useEffect, useState&#125; from &#39;react&#39;;</span><br><span class="line">import ReactECharts from &#39;echarts-for-react&#39;;</span><br><span class="line">import styles from &#39;..&#x2F;styles.module.scss&#39;;</span><br><span class="line">import &#123;color, pathArr&#125; from &#39;..&#x2F;constant&#39;;</span><br><span class="line"></span><br><span class="line">interface Title &#123;</span><br><span class="line">  title: string;</span><br><span class="line">  flag: number;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">const EchartsPageB: FC&lt;any&gt; &#x3D; (&#123;picData&#125;) &#x3D;&gt; &#123;</span><br><span class="line">  const [titleArr, setTitleArr] &#x3D; useState&lt;Title[]&gt;([]);</span><br><span class="line">  const [echartsData, setEchartsData] &#x3D; useState&lt;any[]&gt;([]);</span><br><span class="line">  const [page, setPage] &#x3D; useState&lt;number&gt;(1);</span><br><span class="line">  const [currentPage, setCurrentPage] &#x3D; useState&lt;number&gt;(1);</span><br><span class="line"></span><br><span class="line">  useEffect(() &#x3D;&gt; &#123;</span><br><span class="line">    setEchartsData(picData.series);</span><br><span class="line">    const count &#x3D; picData.series.length % 12;</span><br><span class="line">    if (count &#x3D;&#x3D;&#x3D; 0) &#123;</span><br><span class="line">      setPage(picData.series.length &#x2F; 12);</span><br><span class="line">    &#125; else &#123;</span><br><span class="line">      const str &#x3D; String(picData.series.length &#x2F; 12);</span><br><span class="line">      setPage(Number(parseInt(str, 10)) + 1);</span><br><span class="line">    &#125;</span><br><span class="line">    setTitleArr(picData.series.map((item: Title) &#x3D;&gt; (&#123;title: item.title, flag: 1&#125;)));</span><br><span class="line">  &#125;, [picData]);</span><br><span class="line"></span><br><span class="line">  const option &#x3D; &#123;</span><br><span class="line">    grid: &#123;</span><br><span class="line">      left: 50,</span><br><span class="line">      right: 50,</span><br><span class="line">      bottom: 0,</span><br><span class="line">    &#125;,</span><br><span class="line">    angleAxis: &#123;</span><br><span class="line">      type: &#39;category&#39;,</span><br><span class="line">      axisTick: false,</span><br><span class="line">      boundaryGap: false,</span><br><span class="line">      splitLine: &#123;</span><br><span class="line">        show: true,</span><br><span class="line">        lineStyle: &#123;</span><br><span class="line">          color: &#39;#8d979d&#39;,</span><br><span class="line">        &#125;,</span><br><span class="line">      &#125;,</span><br><span class="line">      axisLabel: &#123;color: &#39;#8d979d&#39;&#125;,</span><br><span class="line">      data: pathArr,</span><br><span class="line">    &#125;,</span><br><span class="line">    tooltip: &#123;</span><br><span class="line">      trigger: &#39;item&#39;,</span><br><span class="line">      position(pos: number[], params: any, dom: any, rect: any, size: any) &#123;</span><br><span class="line">        &#x2F;&#x2F; 鼠标在左侧时 tooltip 显示到右侧，鼠标在右侧时 tooltip 显示到左侧。</span><br><span class="line">        interface Obj &#123;</span><br><span class="line">          left: string | number;</span><br><span class="line">          top: number | string;</span><br><span class="line">          bottom: number | string;</span><br><span class="line">        &#125;</span><br><span class="line">        const obj: Obj &#x3D; &#123;left: &#39;&#39;, top: &#39;&#39;, bottom: &#39;&#39;&#125;;</span><br><span class="line">        const count: boolean &#x3D; pos[1] &lt; size.viewSize[1] &#x2F; 2;</span><br><span class="line">        if (count) &#123;</span><br><span class="line">          obj.bottom &#x3D; 10;</span><br><span class="line">        &#125; else &#123;</span><br><span class="line">          obj.top &#x3D; 10;</span><br><span class="line">        &#125;</span><br><span class="line">        obj.left &#x3D; pos[0] &lt; size.viewSize[0] &#x2F; 2 ? pos[0] : pos[0] - size.contentSize[0];</span><br><span class="line">        return obj;</span><br><span class="line">      &#125;,</span><br><span class="line">      backgroundColor: &#39;rgba(1,9,13,0.7)&#39;,</span><br><span class="line">      borderWidth: 1,</span><br><span class="line">      borderColor: &#39;#2E3C44&#39;,</span><br><span class="line">      formatter: (params: any) &#x3D;&gt; &#123;</span><br><span class="line">        const data &#x3D; picData.series[params.dataIndex].tips[0];</span><br><span class="line">        const infoHtml &#x3D; &#96;&lt;div style&#x3D;&quot;width:250px;padding:0;&quot;&gt;</span><br><span class="line">            &lt;div style&#x3D;&quot;color:white;padding:10px 9px 10px 9px;font-size:16px;font-weight:bold&quot;&gt;风向玫瑰图&lt;&#x2F;div&gt;</span><br><span class="line">            &lt;div  class&#x3D;$&#123;styles.tooltipHr&#125;&gt;&lt;&#x2F;div&gt;</span><br><span class="line">            &lt;div class&#x3D;$&#123;styles.styleA&#125;&gt;</span><br><span class="line">              &lt;span class&#x3D;$&#123;styles.styleE&#125;&gt;风向:&lt;&#x2F;span&gt;</span><br><span class="line">              &lt;div class&#x3D;$&#123;styles.styleB&#125;&gt;</span><br><span class="line">                &lt;span class&#x3D;$&#123;styles.styleC&#125;&gt;$&#123;data[0].path&#125;&lt;&#x2F;span&gt;</span><br><span class="line">                &lt;span class&#x3D;$&#123;styles.styleD&#125;&gt;&lt;&#x2F;span&gt;</span><br><span class="line">              &lt;&#x2F;div&gt;</span><br><span class="line">            &lt;&#x2F;div&gt;</span><br><span class="line">            &lt;div class&#x3D;$&#123;styles.styleA&#125;&gt;</span><br><span class="line">              &lt;span class&#x3D;$&#123;styles.styleE&#125;&gt;风速区间:&lt;&#x2F;span&gt;</span><br><span class="line">              &lt;div class&#x3D;$&#123;styles.styleB&#125;&gt;</span><br><span class="line">                &lt;span class&#x3D;$&#123;styles.styleC&#125;&gt;$&#123;data[2].value&#125;&lt;&#x2F;span&gt;</span><br><span class="line">                &lt;span class&#x3D;$&#123;styles.styleD&#125;&gt;m&#x2F;s&lt;&#x2F;span&gt;</span><br><span class="line">              &lt;&#x2F;div&gt;</span><br><span class="line">              &lt;&#x2F;div&gt;</span><br><span class="line">            &lt;div class&#x3D;$&#123;styles.styleA&#125;&gt;</span><br><span class="line">              &lt;span class&#x3D;$&#123;styles.styleE&#125;&gt;频次:&lt;&#x2F;span&gt;</span><br><span class="line">              &lt;div class&#x3D;$&#123;styles.styleB&#125;&gt;</span><br><span class="line">               &lt;span class&#x3D;$&#123;styles.styleC&#125;&gt;$&#123;data[0].value&#125;&lt;&#x2F;span&gt;</span><br><span class="line">               &lt;span class&#x3D;$&#123;styles.styleD&#125;&gt;次&lt;&#x2F;span&gt;</span><br><span class="line">              &lt;&#x2F;div&gt;  </span><br><span class="line">            &lt;&#x2F;div&gt;</span><br><span class="line">            &lt;div class&#x3D;$&#123;styles.styleA&#125;&gt;</span><br><span class="line">              &lt;span class&#x3D;$&#123;styles.styleE&#125;&gt;频次占比:&lt;&#x2F;span&gt;</span><br><span class="line">              &lt;div class&#x3D;$&#123;styles.styleB&#125;&gt;</span><br><span class="line">               &lt;span class&#x3D;$&#123;styles.styleC&#125;&gt;$&#123;data[3].value&#125;&lt;&#x2F;span&gt;</span><br><span class="line">               &lt;span class&#x3D;$&#123;styles.styleD&#125;&gt;%&lt;&#x2F;span&gt;</span><br><span class="line">              &lt;&#x2F;div&gt; </span><br><span class="line">            &lt;&#x2F;div&gt;</span><br><span class="line">           </span><br><span class="line">          &lt;&#x2F;div&gt;&#96;;</span><br><span class="line"></span><br><span class="line">        return infoHtml;</span><br><span class="line">      &#125;,</span><br><span class="line">    &#125;,</span><br><span class="line">    polar: &#123;</span><br><span class="line">      radius: &#39;80%&#39;,</span><br><span class="line">      center: [&#39;42%&#39;, &#39;50%&#39;],</span><br><span class="line">    &#125;,</span><br><span class="line">    radiusAxis: &#123;&#125;,</span><br><span class="line">    series: [</span><br><span class="line">      &#123;</span><br><span class="line">        type: &#39;bar&#39;,</span><br><span class="line">        data: echartsData.map((item: any) &#x3D;&gt; &#123;</span><br><span class="line">          const pathIndex &#x3D; pathArr.findIndex((k) &#x3D;&gt; k &#x3D;&#x3D;&#x3D; item.tips[0][0].path);</span><br><span class="line">          const newValue &#x3D; item.values[0];</span><br><span class="line">          const dataArr &#x3D; [newValue, pathIndex];</span><br><span class="line">          return dataArr;</span><br><span class="line">        &#125;),</span><br><span class="line">        coordinateSystem: &#39;polar&#39;,</span><br><span class="line">        colorBy: &#39;data&#39;,</span><br><span class="line">        stack: &#39;path&#39;,</span><br><span class="line">      &#125;,</span><br><span class="line">    ],</span><br><span class="line">    color,</span><br><span class="line">  &#125;;</span><br><span class="line"></span><br><span class="line">  const changeLegend &#x3D; (item: Title, index: number) &#x3D;&gt; &#123;</span><br><span class="line">    if (item.flag &#x3D;&#x3D;&#x3D; 1) &#123;</span><br><span class="line">      const newTitleArr &#x3D; titleArr;</span><br><span class="line">      newTitleArr[index].flag &#x3D; 0;</span><br><span class="line">      setTitleArr(newTitleArr);</span><br><span class="line"></span><br><span class="line">      const newArr &#x3D; echartsData.map((k: any, j: number) &#x3D;&gt; &#123;</span><br><span class="line">        const obj &#x3D; &#123;...k&#125;;</span><br><span class="line">        if (index &#x3D;&#x3D;&#x3D; j) &#123;</span><br><span class="line">          obj.values &#x3D; [0];</span><br><span class="line">        &#125;</span><br><span class="line">        return obj;</span><br><span class="line">      &#125;);</span><br><span class="line">      setEchartsData(Object.assign([...newArr]));</span><br><span class="line">    &#125; else if (item.flag &#x3D;&#x3D;&#x3D; 0) &#123;</span><br><span class="line">      const newTitleArr &#x3D; titleArr;</span><br><span class="line">      newTitleArr[index].flag &#x3D; 1;</span><br><span class="line">      setTitleArr(newTitleArr);</span><br><span class="line">      const arr &#x3D; picData.series.filter((k: any) &#x3D;&gt; k.title &#x3D;&#x3D;&#x3D; item.title);</span><br><span class="line">      const newArr &#x3D; echartsData.map((x: any, j: number) &#x3D;&gt; &#123;</span><br><span class="line">        const obj &#x3D; &#123;...x&#125;;</span><br><span class="line">        if (index &#x3D;&#x3D;&#x3D; j) &#123;</span><br><span class="line">          obj.values &#x3D; arr[0].values;</span><br><span class="line">        &#125;</span><br><span class="line">        return obj;</span><br><span class="line">      &#125;);</span><br><span class="line">      setEchartsData(Object.assign([...newArr]));</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;;</span><br><span class="line"></span><br><span class="line">  return (</span><br><span class="line">    &lt;div className&#x3D;&#123;styles.windRose&#125;&gt;</span><br><span class="line">      &lt;div className&#x3D;&#123;styles.title&#125;&gt;</span><br><span class="line">        &lt;span className&#x3D;&#123;styles.dot&#125; &#x2F;&gt;</span><br><span class="line">        &lt;span className&#x3D;&#123;styles.stationName&#125;&gt;&#123;picData.title&#125;&lt;&#x2F;span&gt;</span><br><span class="line">      &lt;&#x2F;div&gt;</span><br><span class="line">      &lt;ReactECharts option&#x3D;&#123;option&#125; style&#x3D;&#123;&#123;height: &#39;400px&#39;&#125;&#125; &#x2F;&gt;</span><br><span class="line">      &lt;div className&#x3D;&#123;styles.legend&#125;&gt;</span><br><span class="line">        &#123;titleArr.map((item: Title, index: number) &#x3D;&gt; &#123;</span><br><span class="line">          if (index + 1 &gt; (currentPage - 1) * 12 &amp;&amp; index + 1 &lt; currentPage * 12) &#123;</span><br><span class="line">            return (</span><br><span class="line">              &lt;div className&#x3D;&#123;styles.legendItem&#125; key&#x3D;&#123;item.title&#125;&gt;</span><br><span class="line">                &lt;span</span><br><span class="line">                  className&#x3D;&#123;styles.legendIcon&#125;</span><br><span class="line">                  style&#x3D;&#123;&#123;background: item.flag ? color[index] : &#39;#6c7379&#39;&#125;&#125;</span><br><span class="line">                  onClick&#x3D;&#123;() &#x3D;&gt; &#123;</span><br><span class="line">                    changeLegend(item, index);</span><br><span class="line">                  &#125;&#125;</span><br><span class="line">                &#x2F;&gt;</span><br><span class="line">                &lt;span className&#x3D;&#123;styles.legendName&#125;&gt;&#123;item.title&#125;&lt;&#x2F;span&gt;</span><br><span class="line">              &lt;&#x2F;div&gt;</span><br><span class="line">            );</span><br><span class="line">          &#125;</span><br><span class="line">          return &#39;&#39;;</span><br><span class="line">        &#125;)&#125;</span><br><span class="line">        &lt;div className&#x3D;&#123;styles.changePage&#125;&gt;</span><br><span class="line">          &lt;span</span><br><span class="line">            className&#x3D;&#123;styles.changePageA&#125;</span><br><span class="line">            onClick&#x3D;&#123;() &#x3D;&gt; &#123;</span><br><span class="line">              if (currentPage &#x3D;&#x3D;&#x3D; 1) &#123;</span><br><span class="line">                return;</span><br><span class="line">              &#125;</span><br><span class="line">              setCurrentPage(currentPage - 1);</span><br><span class="line">            &#125;&#125;&gt;</span><br><span class="line">            &#123;&#39;&lt;&#39;&#125;</span><br><span class="line">          &lt;&#x2F;span&gt;</span><br><span class="line">          &lt;span className&#x3D;&#123;styles.changePageB&#125;&gt;&#123;currentPage&#125;&lt;&#x2F;span&gt;</span><br><span class="line">          &lt;span className&#x3D;&#123;styles.changePageC&#125;&gt;&#123;&#96;&#x2F; $&#123;page&#125;&#96;&#125;&lt;&#x2F;span&gt;</span><br><span class="line">          &lt;span</span><br><span class="line">            className&#x3D;&#123;styles.changePageD&#125;</span><br><span class="line">            onClick&#x3D;&#123;() &#x3D;&gt; &#123;</span><br><span class="line">              if (currentPage &#x3D;&#x3D;&#x3D; page) &#123;</span><br><span class="line">                return;</span><br><span class="line">              &#125;</span><br><span class="line">              setCurrentPage(currentPage + 1);</span><br><span class="line">            &#125;&#125;&gt;</span><br><span class="line">            &#123;&#39;&gt;&#39;&#125;</span><br><span class="line">          &lt;&#x2F;span&gt;</span><br><span class="line">        &lt;&#x2F;div&gt;</span><br><span class="line">      &lt;&#x2F;div&gt;</span><br><span class="line">    &lt;&#x2F;div&gt;</span><br><span class="line">  );</span><br><span class="line">&#125;;</span><br><span class="line"></span><br><span class="line">export default EchartsPageB;</span><br><span class="line"></span><br></pre></td></tr></table></figure>


<h3 id="样式代码"><a href="#样式代码" class="headerlink" title="样式代码"></a>样式代码</h3><figure class="highlight scss"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br></pre></td><td class="code"><pre><span class="line">  <span class="selector-class">.windRose</span> &#123;</span><br><span class="line">    <span class="attribute">display</span>: flex;</span><br><span class="line">    <span class="attribute">position</span>: relative;</span><br><span class="line">    <span class="attribute">flex-direction</span>: column;</span><br><span class="line">    <span class="attribute">width</span>: <span class="number">32%</span>;</span><br><span class="line">    <span class="attribute">margin-bottom</span>: <span class="number">10px</span>;</span><br><span class="line">    <span class="selector-class">.title</span> &#123;</span><br><span class="line">      <span class="attribute">background-color</span>: <span class="number">#0a445a</span>;</span><br><span class="line">      <span class="attribute">display</span>: flex;</span><br><span class="line">      <span class="attribute">align-items</span>: center;</span><br><span class="line">      <span class="attribute">border-radius</span>: <span class="number">7px</span>;</span><br><span class="line">      <span class="attribute">height</span>: <span class="number">30px</span>;</span><br><span class="line">      <span class="attribute">margin-bottom</span>: <span class="number">10px</span>;</span><br><span class="line">      <span class="selector-class">.dot</span> &#123;</span><br><span class="line">        <span class="attribute">background-color</span>: <span class="number">#097488</span>;</span><br><span class="line">        <span class="attribute">margin-left</span>: <span class="number">10px</span>;</span><br><span class="line">        <span class="attribute">margin-right</span>: <span class="number">10px</span>;</span><br><span class="line">        <span class="attribute">border-radius</span>: <span class="number">2px</span>;</span><br><span class="line">        <span class="attribute">width</span>: <span class="number">5px</span>;</span><br><span class="line">        <span class="attribute">height</span>: <span class="number">17px</span>;</span><br><span class="line">      &#125;</span><br><span class="line">      <span class="selector-class">.stationName</span> &#123;</span><br><span class="line">        <span class="attribute">font-size</span>: <span class="number">17px</span>;</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="selector-class">.legend</span> &#123;</span><br><span class="line">      <span class="attribute">position</span>: absolute;</span><br><span class="line">      <span class="attribute">right</span>: <span class="number">0px</span>;</span><br><span class="line">      <span class="attribute">top</span>: <span class="number">60px</span>;</span><br><span class="line">      <span class="attribute">display</span>: flex;</span><br><span class="line">      <span class="attribute">flex-direction</span>: column;</span><br><span class="line">      <span class="attribute">width</span>: <span class="number">110px</span>;</span><br><span class="line">      <span class="attribute">height</span>: <span class="number">350px</span>;</span><br><span class="line">      <span class="attribute">overflow</span>: hidden;</span><br><span class="line">      <span class="selector-class">.legendItem</span> &#123;</span><br><span class="line">        <span class="attribute">display</span>: flex;</span><br><span class="line">        <span class="attribute">width</span>: <span class="number">110px</span>;</span><br><span class="line">        <span class="attribute">align-items</span>: center;</span><br><span class="line">        <span class="attribute">justify-content</span>: space-between;</span><br><span class="line">        <span class="attribute">margin-bottom</span>: <span class="number">7px</span>;</span><br><span class="line">        <span class="selector-class">.legendIcon</span> &#123;</span><br><span class="line">          <span class="attribute">width</span>: <span class="number">12px</span>;</span><br><span class="line">          <span class="attribute">height</span>: <span class="number">12px</span>;</span><br><span class="line">          <span class="attribute">border-radius</span>: <span class="number">2px</span>;</span><br><span class="line">          <span class="attribute">cursor</span>: pointer;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.legendName</span> &#123;</span><br><span class="line">          <span class="attribute">color</span>: <span class="number">#fff</span>;</span><br><span class="line">          <span class="attribute">width</span>: <span class="number">80px</span>;</span><br><span class="line">        &#125;</span><br><span class="line">      &#125;</span><br><span class="line">      <span class="selector-class">.changePage</span> &#123;</span><br><span class="line">        <span class="attribute">display</span>: flex;</span><br><span class="line">        <span class="attribute">align-items</span>: center;</span><br><span class="line">        <span class="attribute">justify-content</span>: space-between;</span><br><span class="line">        <span class="attribute">height</span>: <span class="number">30px</span>;</span><br><span class="line">        <span class="attribute">width</span>: <span class="number">100%</span>;</span><br><span class="line">        <span class="attribute">position</span>: absolute;</span><br><span class="line">        <span class="attribute">bottom</span>: <span class="number">0</span>;</span><br><span class="line">        <span class="attribute">right</span>: <span class="number">0</span>;</span><br><span class="line">        <span class="attribute">background-color</span>: <span class="number">#0a445a</span>;</span><br><span class="line">        <span class="selector-class">.changePageA</span> &#123;</span><br><span class="line">          <span class="attribute">width</span>: <span class="number">25px</span>;</span><br><span class="line">          <span class="attribute">height</span>: <span class="number">25px</span>;</span><br><span class="line">          <span class="attribute">text-align</span>: center;</span><br><span class="line">          <span class="attribute">border</span>: <span class="number">1px</span> solid <span class="number">#00e4ff</span>;</span><br><span class="line">          <span class="attribute">border-radius</span>: <span class="number">4px</span>;</span><br><span class="line">          <span class="attribute">color</span>: <span class="number">#00e4ff</span>;</span><br><span class="line">          <span class="attribute">cursor</span>: pointer;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.changePageB</span> &#123;</span><br><span class="line">          <span class="attribute">width</span>: <span class="number">25px</span>;</span><br><span class="line">          <span class="attribute">height</span>: <span class="number">25px</span>;</span><br><span class="line">          <span class="attribute">text-align</span>: center;</span><br><span class="line">          <span class="attribute">border</span>: <span class="number">1px</span> solid <span class="number">#00e4ff</span>;</span><br><span class="line">          <span class="attribute">border-radius</span>: <span class="number">4px</span>;</span><br><span class="line">          <span class="attribute">color</span>: <span class="number">#fff</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.changePageC</span> &#123;</span><br><span class="line">          <span class="attribute">color</span>: <span class="number">#fff</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="selector-class">.changePageD</span> &#123;</span><br><span class="line">          <span class="attribute">width</span>: <span class="number">25px</span>;</span><br><span class="line">          <span class="attribute">height</span>: <span class="number">25px</span>;</span><br><span class="line">          <span class="attribute">text-align</span>: center;</span><br><span class="line">          <span class="attribute">border</span>: <span class="number">1px</span> solid <span class="number">#00e4ff</span>;</span><br><span class="line">          <span class="attribute">border-radius</span>: <span class="number">4px</span>;</span><br><span class="line">          <span class="attribute">color</span>: <span class="number">#00e4ff</span>;</span><br><span class="line">          <span class="attribute">cursor</span>: pointer;</span><br><span class="line">        &#125;</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-class">.echartsBox</span> &#123;</span><br><span class="line">    <span class="attribute">overflow-y</span>: scroll;</span><br><span class="line">    <span class="attribute">height</span>: calc(<span class="number">100%</span> - <span class="number">48px</span>);</span><br><span class="line">    <span class="selector-class">.windFrqBox</span> &#123;</span><br><span class="line">      <span class="attribute">display</span>: flex;</span><br><span class="line">      <span class="attribute">flex-wrap</span>: wrap;</span><br><span class="line">      <span class="attribute">justify-content</span>: space-between;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="selector-class">.windRoseBox</span> &#123;</span><br><span class="line">      <span class="attribute">display</span>: flex;</span><br><span class="line">      <span class="attribute">flex-wrap</span>: wrap;</span><br><span class="line">      <span class="attribute">justify-content</span>: space-between;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="selector-class">.tooltipHr</span> &#123;</span><br><span class="line">  <span class="attribute">background</span>: <span class="number">#4c555a</span>;</span><br><span class="line">  <span class="attribute">width</span>: <span class="number">250px</span>;</span><br><span class="line">  <span class="attribute">height</span>: <span class="number">2px</span>;</span><br><span class="line">  <span class="attribute">margin-bottom</span>: <span class="number">15px</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.styleA</span> &#123;</span><br><span class="line">  <span class="attribute">display</span>: flex;</span><br><span class="line">  <span class="attribute">justify-content</span>: space-between;</span><br><span class="line">  <span class="attribute">align-items</span>: center;</span><br><span class="line">  <span class="attribute">padding</span>: <span class="number">0</span> <span class="number">9px</span> <span class="number">0</span> <span class="number">9px</span>;</span><br><span class="line">  <span class="attribute">margin-bottom</span>: <span class="number">10px</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-class">.styleE</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#fff</span>;</span><br><span class="line">  <span class="attribute">font-size</span>: <span class="number">14px</span>;</span><br><span class="line">  <span class="attribute">font-weight</span>: bold;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.styleB</span> &#123;</span><br><span class="line">  <span class="attribute">display</span>: flex;</span><br><span class="line">  <span class="attribute">align-items</span>: center;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-class">.styleC</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#00e4ff</span>;</span><br><span class="line">  <span class="attribute">font-size</span>: <span class="number">14px</span>;</span><br><span class="line">  <span class="attribute">margin-right</span>: <span class="number">8px</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.styleD</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#6c7379</span>;</span><br><span class="line">  <span class="attribute">width</span>: <span class="number">30px</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
 
      <!-- reward -->
      
    </div>
    

    <!-- copyright -->
    
    <footer class="article-footer">
       
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=https://gitee.com/shimmer612/myBlog/2022/05/19/2022-05-19-echarts%E5%AE%9E%E7%8E%B0%E9%A3%8E%E5%90%91%E7%8E%AB%E7%91%B0%E5%9B%BE/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>  
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/myBlog/tags/React/" rel="tag">React</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/myBlog/tags/echarts/" rel="tag">echarts</a></li></ul>

    </footer>
  </div>

   
  <nav class="article-nav">
    
      <a href="/myBlog/2022/08/09/2022-08-09-react%E8%87%AA%E5%AE%9A%E4%B9%89hook,useWebSocket/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            react自定义hook,useWebSocket
          
        </div>
      </a>
    
    
      <a href="/myBlog/2022/05/09/2022-05-09-reduxjsToolkit%E4%BD%BF%E7%94%A8/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">reduxjs/toolkit使用</div>
      </a>
    
  </nav>

   
<!-- valine评论 -->
<div id="vcomments-box">
  <div id="vcomments"></div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/valine@1.4.14/dist/Valine.min.js"></script>
<script>
  new Valine({
    el: "#vcomments",
    app_id: "xGZKFxfEhEyqsK7YA4NNoQNr-gzGzoHsz",
    app_key: "qCe4kOh0W9rCgNWcv31cO3NF",
    path: window.location.pathname,
    avatar: "monsterid",
    placeholder: "说出你想说的吧~",
    recordIP: true,
  });
  const infoEle = document.querySelector("#vcomments .info");
  if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
    infoEle.childNodes.forEach(function (item) {
      item.parentNode.removeChild(item);
    });
  }
</script>
<style>
  #vcomments-box {
    padding: 5px 30px;
  }

  @media screen and (max-width: 800px) {
    #vcomments-box {
      padding: 5px 0px;
    }
  }

  #vcomments-box #vcomments {
    background-color: #fff;
  }

  .v .vlist .vcard .vh {
    padding-right: 20px;
  }

  .v .vlist .vcard {
    padding-left: 10px;
  }
</style>

 
   
     
</article>

</section>
      <!--
 * @Author: zhangzhen
 * @Date: 2023-02-04 10:30:09
 * @LastEditors: zhangzhen
 * @LastEditTime: 2023-05-23 09:47:12
 * 
-->
<footer class="footer">
  <div class="outer">
    <ul>
      <li>
        Copyrights &copy;
        2021-2023
        <i class="ri-heart-fill heart_icon"></i> Shimmer
      </li>
    </ul>
    <!-- <ul>
      <li>
        
        
        
        由 <a href="https://hexo.io" target="_blank">Hexo</a> 强力驱动
        <span class="division">|</span>
        主题 - <a href="https://github.com/Shen-Yu/hexo-theme-ayer" target="_blank">Ayer</a>
        
      </li>
    </ul> -->
    <ul>
      <li>
        
        
        <span>
  <span><i class="ri-user-3-fill"></i>访问人数:<span id="busuanzi_value_site_uv"></span></s>
  <span class="division">|</span>
  <span><i class="ri-eye-fill"></i>浏览次数:<span id="busuanzi_value_page_pv"></span></span>
</span>
        
      </li>
    </ul>
    <ul>
      
    </ul>
    <ul>
      
    </ul>
    <ul>
      <li>
        <!-- cnzz统计 -->
        
      </li>
    </ul>
  </div>
</footer>
      <div class="float_btns">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>

<div class="todark" id="todark">
  <i class="ri-moon-line"></i>
</div>

      </div>
    </main>
    <aside class="sidebar on">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/myBlog/"><img src="/myBlog/images/ayer-side.svg" alt="Shimmer"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/myBlog/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/myBlog/archives">目录</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/myBlog/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/myBlog/photos">相册</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/myBlog/2021/02/12/2021-02-12-%E5%85%B3%E4%BA%8E%E6%88%91/">关于我</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/myBlog/message">留言板</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <script>
      if (window.matchMedia("(max-width: 768px)").matches) {
        document.querySelector('.content').classList.remove('on');
        document.querySelector('.sidebar').classList.remove('on');
      }
    </script>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    
  </div>
</div>
    
<script src="/myBlog/js/jquery-2.0.3.min.js"></script>


<script src="/myBlog/js/lazyload.min.js"></script>

<!-- Tocbot -->


<script src="/myBlog/js/tocbot.min.js"></script>

<script>
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: 'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto'
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>

<script src="/myBlog/dist/main.js"></script>

<!-- ImageViewer -->

<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.min.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>

<!-- MathJax -->

<!-- Katex -->

<!-- busuanzi  -->


<script src="/myBlog/js/busuanzi-2.3.pure.min.js"></script>


<!-- ClickLove -->

<!-- ClickBoom1 -->

<!-- ClickBoom2 -->


<script src="/myBlog/js/clickBoom2.js"></script>


<!-- CodeCopy -->


<link rel="stylesheet" href="/myBlog/css/clipboard.css">

<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<script>
  function wait(callback, seconds) {
    var timelag = null;
    timelag = window.setTimeout(callback, seconds);
  }
  !function (e, t, a) {
    var initCopyCode = function(){
      var copyHtml = '';
      copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
      copyHtml += '<i class="ri-file-copy-2-line"></i><span>COPY</span>';
      copyHtml += '</button>';
      $(".highlight .code pre").before(copyHtml);
      $(".article pre code").before(copyHtml);
      var clipboard = new ClipboardJS('.btn-copy', {
        target: function(trigger) {
          return trigger.nextElementSibling;
        }
      });
      clipboard.on('success', function(e) {
        let $btn = $(e.trigger);
        $btn.addClass('copied');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-checkbox-circle-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPIED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-checkbox-circle-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
      clipboard.on('error', function(e) {
        e.clearSelection();
        let $btn = $(e.trigger);
        $btn.addClass('copy-failed');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-time-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPY FAILED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-time-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
    }
    initCopyCode();
  }(window, document);
</script>


<!-- CanvasBackground -->


    
  </div>
</body>

</html>